package gui;
import javax.swing.*;
import java.awt.*;

public class borderLayout extends JFrame {
    public borderLayout(){
        setTitle("示例");
        setSize(600,400);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLayout(new BorderLayout(10,5));
        //north
        JPanel northPanel=new JPanel();
        northPanel.setBackground(Color.LIGHT_GRAY);
        northPanel.add(new JLabel("顶部工具栏"));
        northPanel.add(new JButton("文件"));
        northPanel.add(new JButton("编辑"));
        add(northPanel,BorderLayout.NORTH);
        //sourth
        JLabel southLable=new JLabel("状态栏：就绪");
        southLable.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
        add(southLable,BorderLayout.SOUTH);

        //East
        JTextArea eastText=new JTextArea("右侧日志区域");
        eastText.setBackground(new Color(240,240,240));
        add(new JScrollPane(eastText),BorderLayout.EAST);
        //West
        JPanel westPanel=new JPanel();
        westPanel.setLayout(new GridLayout(3,1,10,10));
        westPanel.add(new JButton("导航1"));
        westPanel.add(new JButton("导航2"));
        westPanel.add(new JButton("导航3"));
        add(westPanel,BorderLayout.WEST);
        //center
        JTextArea centerText = new JTextArea("中央主内容区域");
        add(new JScrollPane(centerText),BorderLayout.CENTER);
        setVisible(true);
    }

    public static void main(String[] args) {
        new borderLayout();
    }
}

